<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./jquery.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function (){
            function delDept(id){
                var flag = confirm("确认删除部门吗")
                if(flag){
                    var deptid = id;//要删的部门id
                    // location.href="/delDept?id="+deptid
                }else {
                    return false
                }

            }
            $(".ddel").click(function (){
                var flag = confirm("确认删除部门吗")
                if(flag) {
                    var href = $(this).attr("href")
                    $("[name=did]").val(href);
                    $("form").submit()
                    return true
                }else
                return false
            })
        })
    </script>
</head>
<body>
<table>
    <tr>
<!--        <th>id</th>-->
        <th>编号</th>
        <th>名称</th>
        <th>电话</th>
        <th>地址</th>
        <th>操作</th>
        td{$}*4
    </tr>
    <tr th:each="dept:${depts}">
        <td th:text="${dept.id}">id</td>
        <td th:text="${dept.name}"></td>
        <td th:text="${dept.telephone}"></td>
        <td th:text="${dept.address}"></td>
        <td>
            <a  th:href="@{'/toUpdateDept?id='+${dept.id}}">修改</a>
<!--            <a  href="javascript:delDeptId(${dept.id})" class="ddel">删除</a>-->
            <a  th:href="@{'/toDeteleDept?id='+${dept.id}}" class="ddel">删除</a>
        </td>
    </tr>
    <script>

    </script>
</table>
</body>
</html>